<?php 
/**************************************************/
## Class Name - Model_City (Contains all the functions related City modules)
## Created By - Techmodi (22/08/2011)
/**************************************************/
class Model_Analytics extends Database
{	
	function Model_Analytics() {	
		$this->analytics = ANALYTICS;	
		$this->Database();
	}
	
	function addAnalytics($array) {
		$this->InsertData($this->analytics, $array);
	}
	
	## List all submenus
	function getAllAnalytics($search='',$col1="",$limit='',$offset='') {
		$fields = array();	
		$tables = array($this->analytics);
		if($col1=='1')
			$order = array("analytics_name DESC");
		else
			$order = array("analytics_name ASC");
		$result1 = $this->SelectData($fields,$tables, $where= array("analytics_name LIKE '%".$search."%'"), $order , $group=array(),$limit,$offset,0); 
		$result  = $this->FetchAll($result1); 
		return $result;
	}
	
	## Get submenu details by id
	function getAnalyticsDetailsById($Analytics_id) {
		$fields = array();	
		$tables = array($this->analytics);
		$result1 = $this->SelectData($fields,$tables, $where= array("analytics_id='".$Analytics_id."'"), $order = array(), $group=array(),$limit = "",0,0); 
		$result  = $this->FetchRow($result1); 
		return $result;
	}
	
	## Delete Analytics with multiple ids
	function deleteAnalytics($ids) {
		$sql = "DELETE FROM ".$this->analytics." WHERE analytics_id IN (".$ids.")";
		$result1= $this->ExecuteQuery($sql);	 
	}
	
	
	## Delete faq cat by id
	function deleteAnalyticsById($id){
		$this->DeleteData($this->analytics,"analytics_id",$id);
	}
	
	## Edit FAQ by id
	function editAnalyticsById($array, $Id){
		$this->UpdateData($this->analytics,$array,"analytics_id",$Id,0);
	}
	

    ## Update faq status with multiple ids
	function updateAnalyticsStatus($ids, $status) {
		$sql = "UPDATE ".$this->analytics." SET status='".$status."' WHERE analytics_id IN (".$ids.")";
		$result1= $this->ExecuteQuery($sql);	 
	}
	

	
}
?>


